package com.thinkgem.jeesite.common.listener;

public class OnlineCount {
	private static int onlineCount = 0;

	public static int getOnlineCount() {
		return onlineCount;
	}

	public static void setOnlineCount(int onlineCount) {
		OnlineCount.onlineCount = onlineCount;
	}
	
	// 增加
	public static synchronized void increment(int time)
	{
		onlineCount += time;
	}
	
	// 减少
	public static synchronized void reduce(int time)
	{
		if(onlineCount > time)
		{
			onlineCount -= time;
		}
	}
	
}
